/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aviso.entity.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author avgusti
 */
public class PasswordUtil {

    public static String genPassHash(String pass) {
        try {
            byte[] data = pass.getBytes();
            MessageDigest md = MessageDigest.getInstance("SHA-1");
            md.reset();
            md.update(data);
            byte[] hash = md.digest();
            return new String(hash);
        } catch (NoSuchAlgorithmException ex) {
            Logger.getLogger(PasswordUtil.class.getName()).log(Level.SEVERE, null, ex);
        }
        return "";
    }
}
